package com.multimedia.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class UtilTools {
    public static String timeTostrHMS(Date date) {
        String strDate = "";
        if (date != null) {
            SimpleDateFormat format = new SimpleDateFormat(
                    "yyyy-MM-dd HH:mm:ss");
            strDate = format.format(date);
        }
        return strDate;
    }
    public static String converStr(String str, String encode) {
        if (str == null || str.equals("null")) {
            return "";
        }
        try {
            byte[] tmpbyte = str.getBytes("ISO8859_1");
            if (encode != null) {
                // 如果指定编码方式
                str = new String(tmpbyte, encode);
            } else {
                // 用系统默认的编码
                str = new String(tmpbyte);
            }
            return str;
        } catch (Exception e) {
        }
        return str;
    }
}
